/*gUN9IS9e+92V0xt53KL7/hyB8V01VxJcqrS7+tWkbRPWegy0FdisiEFkAhR8EWxH*/
/*
* 参照控制
* */

import constants from '../../constants';
const { AREA: { CARD: { BASIC_INFO_AREA: basicInfoForm, USEDEPT_TAB: usedept_tab } } } = constants;

/*
* 更新部门是否能够选择非末级
* */
function updateDeptRefLevel(that, is_allow_dept_midlev_new) {
	if (!is_allow_dept_midlev_new) {
		return;
	}

	that.is_allow_dept_midlev = is_allow_dept_midlev_new;
	let meta = that.props.meta.getMeta();
	meta[basicInfoForm].items.map((item) => {
		// 管理部门
		if (item.attrcode === 'pk_mandept' || item.attrcode === 'pk_mandept_v') {
			item.onlyLeafCanSelect = !is_allow_dept_midlev_new;
		}
		// 使用部门
		if (item.attrcode === 'pk_usedept' || item.attrcode === 'pk_usedept_v') {
			item.onlyLeafCanSelect = !is_allow_dept_midlev_new;
		}
	});

	//更新多使用部门页签
	meta[usedept_tab].items.map((item, key) => {
		if (item.attrcode == 'pk_dept' || item.attrcode == 'pk_dept_v') {
			item.onlyLeafCanSelect = !is_allow_dept_midlev_new;
		}
	});

	that.props.meta.setMeta(meta);
}

export { updateDeptRefLevel };

/*gUN9IS9e+92V0xt53KL7/hyB8V01VxJcqrS7+tWkbRPWegy0FdisiEFkAhR8EWxH*/